<template>
<div class="nav-side">
    <el-menu mode="horizontal" :default-active="$route.path" :router="true" class="side-menu" :collapse-transition="false">
        <template v-for="(item, index) in menuList">
            <el-submenu v-if="item.children" :key="index" :index="item.path">
                <template slot="title">
                    <i :class="item.icon"></i>
                    <span>{{item.name}}</span>
                </template>
                <el-menu-item v-for="(sub, i) in item.children" :key="i" :index="sub.path">
                    <i :class="sub.icon"></i>
                    <span slot="title">{{sub.name}}</span>
                </el-menu-item>
            </el-submenu>
            <el-menu-item v-else :key="index" :index="item.path">
                <i :class="item.icon"></i>
                <span slot="title">{{item.name}}</span>
            </el-menu-item>
        </template>
    </el-menu>
</div>
</template>

<script>
export default {
    name: 'NavSide',
    data () {
        return {
            menuList: [
                {
                    name: 'Kios',
                    path: '/kios'
                },
                {
                    name: '邀请明细',
                    path: '/invite'
                },
                {
                    name: '规则',
                    path: '/rule'
                }
            ]
        }
    }
}
</script>

<style lang="less">
.nav-side {
    height: 100%;
    display: flex;

    .el-menu {
        border-right: 0;
    }

    .side-menu {
        height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }
    .el-menu-item {
        height: 48px;
        line-height: 48px;
    }
    .el-menu.el-menu--horizontal {
        border-bottom: none;
    }
}
</style>
